package activemq.spring;

import org.springframework.stereotype.Component;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.TextMessage;

@Component
public class ActiveMessageListener implements javax.jms.MessageListener {
    @Override
    public void onMessage(Message message) {
        try {
            TextMessage textMessage = (TextMessage)message;
            String data = textMessage.getText();
            System.out.println("data: " + data);
        } catch (JMSException e) {
            System.out.println("消息接收失败！");
        }
    }
}
